
#ifndef _TTG_EXTRAS_OPERATIONMAPPER_
#define _TTG_EXTRAS_OPERATIONMAPPER_

#include "ValueWrappers.h"
#include "AddOperations.h"
#include "SubOperations.h"
#include "MulOperations.h"
#include "DivOperations.h"
#include "Functions.h"

namespace ttg_internal
{
	//Provides references to OperationInfo by OperationName and types of operands.
	class OperationMapper
	{
		private:
			OperationInfo *opbase[6][4][4][4];
			OperationMapper();
			inline void add(OperationInfo::OperationName opname,
							OperationInfo *val,
							OperationInfo::OperationType optype1,
							OperationInfo::OperationType optype2 = OperationInfo::UNKNOWN,
							OperationInfo::OperationType optype3 = OperationInfo::UNKNOWN)
					{ opbase[opname][optype1][optype2][optype3] = val; }
			~OperationMapper();
		private:
			static OperationMapper *mapper;
		public:
			static OperationInfo *get(OperationInfo::OperationName opname,
									  OperationInfo::OperationType optype1,
									  OperationInfo::OperationType optype2,
									  OperationInfo::OperationType optype3);
			static OperationInfo *create(OperationInfo::OperationName opname,
										 OperationInfo *op1,
										 OperationInfo *op2 = NULL,
										 OperationInfo *op3 = NULL);
	};
}

#endif
